import { defineStore } from 'pinia';
import { LocationQueryValue } from 'vue-router';
export const userStore = defineStore('user', {
  state: () => ({
    invite_code:'' as LocationQueryValue | LocationQueryValue[],
    room_id:'' as LocationQueryValue | LocationQueryValue[],
    tipsOpenSet:false as Boolean
  }),
  getters: {
    
  },
  actions: {
    async getSystemInfo() {
      // const res = await request.getSystemInfo()
      // const { now_time=0 } = res.data
    },
    getPlatform (){
      const userAgent = navigator.userAgent.toLowerCase()
      console.log('userAgent', userAgent)
      if(userAgent.match(/qqbrowser/i) && userAgent.match(/webp/i)) {
        console.log('浏览器类型：qq内置浏览器');
        return this.tipsOpenSet = true
      }
      if(userAgent.match(/wkwebview/i)) {
        console.log('内置浏览器');
        return this.tipsOpenSet = true
      }
      if(userAgent.match(/micromessenger/i)) {
        console.log('浏览器类型：微信浏览器');
        return this.tipsOpenSet = true
      }
      
    }
  },
})